<?php
$this->Paginator->options(array(
    'url' => $contentsTableURL,
    'update' => '.contents.table',
    'evalScripts' => true
));
?>
<table class="table table-striped">
    <tr>
        <th class="actions"><?php echo __d('admin', 'Content VN'); ?></th>
        <th class="actions"><?php echo __d('admin', 'Content EN'); ?></th>
        <th><?php echo $this->Paginator->sort('category_id', __d('admin', 'Category'), array('model' => $contentsTableModelAlias)); ?></th>
        <th class="actions"><?php echo __d('admin', 'Actions'); ?></th>
    </tr>
    <?php foreach ($contents as $content): ?>
        <tr>
            <td>
                <?php echo String::truncate(strip_tags($content['Content']['text']), 50, array('exact' => true));?>
            </td>
             <td>
                <?php echo String::truncate(strip_tags($content['Content']['text_eng']), 50, array('exact' => true));?>
            </td>
            <td>
                <?php echo $this->Html->link($content['Category']['toString'], array('controller' => 'admin_categories', 'action' => 'view', $content['Category']['id'])); ?>
            </td>
            <td class="actions">
                <?php echo $this->Html->link(__d('admin', 'View'), array('plugin' => 'admin', 'controller' => 'admin_contents', 'action' => 'view', $content[$contentsTableModelAlias]['id']), array('class' => 'btn btn-info btn-xs')); ?>
                <?php echo $this->Html->link(__d('admin', 'Edit'), array('plugin' => 'admin', 'controller' => 'admin_contents', 'action' => 'edit', $content[$contentsTableModelAlias]['id'], '?' => array('redirect' => $redirectUrl)), array('class' => 'btn btn-default btn-xs')); ?>
                <?php echo $this->Form->postLink(__d('admin', 'Delete'), array('plugin' => 'admin', 'controller' => 'admin_contents', 'action' => 'delete', $content[$contentsTableModelAlias]['id'], '?' => array('redirect' => $redirectUrl)), array('class' => 'btn btn-danger btn-xs'), __d('admin', 'Are you sure you want to delete # %s?', $content[$contentsTableModelAlias]['id'])); ?>
            </td>
        </tr>
    <?php endforeach; ?>
</table>
<?php if ($this->Paginator->counter('{:pages}') > 1) : ?>
    <div>
        <ul class="pagination">
            <?php
            echo '<li>' . $this->Paginator->prev('Prev', array('model' => $contentsTableModelAlias), null, array('class' => 'prev disabled')) . '</li>';
            echo $this->Paginator->numbers(array('separator' => '', 'tag' => 'li', 'currentTag' => 'span', 'currentClass' => 'active', 'model' => $contentsTableModelAlias));
            echo '<li>' . $this->Paginator->next('Next', array('model' => $contentsTableModelAlias), null, array('class' => 'next disabled')) . '</li>';
            ?>
        </ul>
    </div>
<?php endif; ?>

<?php
echo $this->Js->writeBuffer();